﻿using furion.blog.Domain.MySQL;
using furion.blog.Domain.Query.User;
using furion.blog.Domain.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace furion.blog.Domain.IRepositories
{
    public interface IUserRepository
    {
        /// <summary>
        /// 通过账号查找
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        Task<User> FindByUsername(string username);

        /// <summary>
        /// 查询第一条数据
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        Task<User> First(Expression<Func<User, bool>> exp);

        /// <summary>
        /// 统计
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        Task<long> Count(Expression<Func<User, bool>> exp);

        /// <summary>
        /// 通过id查询
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<User> FindByUserId(long userId);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        Task Update(User user);

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        Task Save(User user);


        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        Task<PageVO> List(UserListQuery query);

    }
}
